package com.daihou.BCJ.others;

import com.daihou.model.ceres.In_Others;
import com.daihou.utils.ConfigOthers;
import com.daihou.utils.DHHttpUtil;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class otHuankuan {
	private String url;
	Map<String, String> headers;
	@BeforeTest(description = "测试准备工作,获取Authorization对象")
	public void beforeTest() throws IOException {
		url= ConfigOthers.getUrl(In_Others.HUANKUAN.toString());
		headers=new HashMap<>();
		//设置请求头中的Authorization
		//headers.put("Authorization", TheAuth.getAuth());
		//需要admin权限
		//headers.put("X-UserName", "admin");
	}

	@Test(description = "账务还款回调")
	public void s1() throws IOException {
		String strBody = "{\"deductAmount\":2764.8,\"failReason\":\"\",\"isSplit\":false,\"payStatus\":\"SUCCESS\",\"repayTransType\":\"COMMON_REPAY\",\"transSerialNo\":\"6bb934e4b2874f0abb89962ab1c43376\",\"type\":\"REPAY\"}";
		String result = DHHttpUtil.post_with_String(url,strBody,headers).toJSONString();
		System.out.println("================ "+result);
		//后端返回000000状态码 与前端不一样
		Assert.assertTrue(result.contains("\"message\":\"操作成功\",\"status\":\"000000\""));
	}
}